<template>
  <div class="detail-wrapper">
    <DetailBanner :sightName="sightName" :bannerImg="bannerImg" :galleryImgs="galleryImgs"></DetailBanner>
    <DetailHeader></DetailHeader>
    <DetailList :categoryList="categoryList"></DetailList>
    <div class="content"></div>
  </div>
</template>

<script>
import DetailBanner from "./components/Banner";
import DetailHeader from "./components/Header";
import DetailList from "./components/List";
import axios from "axios";

export default {
  name: "Detail",
  data() {
    return {
      sightName: "",
      categoryList: "",
      galleryImgs: "",
      bannerImg: ""
    };
  },
  components: {
    DetailBanner,
    DetailHeader,
    DetailList
  },
  methods: {
    getDetailInfo() {
      axios
        .get("api/detail.json", {
          params: {
            id: this.$route.id
          }
        })
        .then(this.getDetailInfoSucc);
    },
    getDetailInfoSucc(res) {
      res = res.data;

      if (res.ret && res.data) {
        this.sightName = res.data.sightName;
        this.categoryList = res.data.categoryList;
        this.galleryImgs = res.data.gallaryImgs;
        this.bannerImg = res.data.bannerImg;
      }
    }
  },
  mounted() {
    this.getDetailInfo();
  }
};
</script>

<style lang="stylus" scoped>
.detail-wrapper {
  touch-action: none;

  .content {
    height: 50rem;
  }
}
</style>
